<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.css" rel="stylesheet" />
		<script src="js/mui.js"></script>
		<script src="js/weixin_utils.js"></script>
		<script type="text/javascript">
			mui.init();
			mui.plusReady(function(){
				document.getElementById("searchFriend_btn").addEventListener('tap',function(){
					// 获取输入值
					var search_key = document.getElementById('search_key').value;
					// 用户不存在不进行跳转
					util.ajax({
						url: api.searchFriend,
						data: {
							"search_key": search_key
						},
						success: function(resp) {
							if (resp.code == 200 && resp.httpCode == 200) {
								// 打开搜索结果页面
								mui.openWindow({
									url: 'searchResult.html',
									id: 'searchResult.html',
									extras: { //向新页面传参
										'data': resp.data
									}
								})
							} else if(resp.code == 1){
								
								plus.nativeUI.toast(resp.msg);
							}
						}
					})
					
				})
			})
		</script>
	</head>

	<body style="background-color: rgb(247, 247, 247);">
		<header class="mui-bar mui-bar-nav" style="box-shadow: none;">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">添加朋友</h1>
		</header> 
		
		<div style="margin-top: 50px; text-align: center;">
			<div class="mui-input-row mui-search">
			    <input id="search_key" type="search" class="mui-input-clear" placeholder="账号/手机号" style="background-color: #fff; width: 95%; display: inline-block;">
			</div>
			
			<div class="mui-button-row">
				<button type="button" id="searchFriend_btn" class="mui-btn mui-btn-success" style="width: 80%;">搜索</button>
			</div> 
		</div>
		
	</body>

</html>